//
//  ResultWrapper.swift
//  BaseProj
//
//  Created by 陈宇 on 2017/4/27.
//  Copyright © 2017年 科匠武汉. All rights reserved.
//

import UIKit
import ObjectMapper

class ResultWrapper<T: BaseBean>: ObjectMapper.Mappable {
    
    var code: Int = 0
    var message: String = ""
    var data: T?
    
    required init?(map: Map) {
        if map.JSON["code"] == nil {
            return nil
        }
    }
    
    func mapping(map: Map) {
        code <- map["code"]
        message <- map["message"]
        data <- map["data"]
    }

}

extension ResultWrapper: CustomDebugStringConvertible {
    public var debugDescription: String {
        return "ResultWrapper: \(self.toJSON())"
    }
}
